package crud.client.factory.form;

import java.io.Serializable;

import com.google.gwt.user.client.rpc.IsSerializable;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;

import crud.client.data.Colonne;
import crud.client.factory.form.multiple.value.MultipleValueFormItemFactory;

public abstract class ComboBoxFactory extends MultipleValueFormItemFactory implements Serializable, IsSerializable
{
	
	@Override
	public FormItem newMultipleFormItem(Colonne colonne)
	{
		SelectItem libelleComboBox = new SelectItem();
		libelleComboBox.setDefaultToFirstOption(!colonne.isNullable());
		
		// Enregistrement vide ?
		if (colonne.isNullable())
		{
			libelleComboBox.setAllowEmptyValue(true);
		}
	
		return libelleComboBox;
	}
	
}
